/**
 * Created by xxx on 2017/5/17.
 */
//用react封装
var currentpage = 1,totlepage = 1,i;//分页的当前页和总的页数 手机号码格式是否正确
var tableData = [],importRepeatData = [],schoolDataAll = [],schoolDataList = [];
//表单的最高高度、当前第几页、总页数、总行数
var otherData = {pageLeft:0,pageRight:0};
//分页
var Page = React.createClass({
    setPage: function (e) {
        setPage($(e.target).html());
        this.props.onPageClick(1);
    },
    showPage: function () {
        showPage();
    },
    render: function () {
        {
            var items = [],
                svar = this;
            if(totlepage == 0 ){
                items.push({num:1,checked:true})
            }else if(totlepage < 6){
                for(i = 1;i <= totlepage ;i++) {
                    if (i == currentpage) {
                        items.push({num:i,checked:true})
                    } else {
                        items.push({num:i,checked:false})
                    }
                }
            }else if(currentpage >= (totlepage-2)) {//点在左边
                items.push({num:1,checked:false});
                items.push({num:'···',checked:false});
                for(i = totlepage-2;i <= totlepage ;i++){
                    if(i == currentpage){
                        items.push({num:i,checked:true})
                    }else{
                        items.push({num:i,checked:false})
                    }
                }
            }else if(currentpage <= 3){
                for(i = 1;i <= 3 ;i++) {
                    if (i == currentpage) {
                        items.push({num:i,checked:true})
                    } else {
                        items.push({num:i,checked:false})
                    }
                }
                items.push({num:'···',checked:false});
                items.push({num:totlepage,checked:false})
            }else {//点在两边
                items.push({num:1,checked:false});
                items.push({num:'···',checked:false});
                items.push({num:currentpage-1,checked:false});
                items.push({num:currentpage,checked:true});
                items.push({num:currentpage+1,checked:false});
                items.push({num:'···',checked:false});
                items.push({num:totlepage,checked:false})
            }
        }
        return (
            <div className="tableInfo-page">
                <div className="page-number">每页<span className="page-number-list" onClick={this.showPage}>{pagecount}</span>条</div>
                <div className="page-list" style={{top:pageListTop+"px"}}>
                    <ul>
                        {
                            pageList.map(function (item) {
                                return (<li onClick={svar.setPage}>{item}</li>)
                            })
                        }
                    </ul>
                </div>
                <div className="page-limit">
                    <ol className="page-limit-ol">
                        <li className="page-limit-img" name="-1" onClick={otherData.pageLeft == 0?'':svar.props.onPageClick.bind(svar,-1)}><span className={otherData.pageLeft == 0?'page-limit-left-no':'page-limit-left-yes'}/></li>
                        {
                            items.map(function (item) {
                                return (<li onClick={isNaN(item.num)?'':svar.props.onPageClick.bind(svar,item.num)}  className={item.checked == true?'page-limit-num page-limit-checked':'page-limit-num'} name={item.num}>{item.num}</li>)
                            })
                        }
                        <li className="page-limit-img" name="-2" onClick={otherData.pageRight == 0?'':svar.props.onPageClick.bind(svar,-2)}><span className={otherData.pageRight == 0?'page-limit-right-no':'page-limit-right-yes'}/></li>
                    </ol>
                </div>
            </div>
        );
    }
});
//表单组件
var Table = React.createClass({
    render: function () {
        return (
            <tr>
                <td style={{width: '10%'}}>{parseInt(this.props.listNumber)+1}</td>
                <td style={{width: '15%'}}>{this.props.teachername}</td>
                <td style={{width: '15%'}}>{this.props.telephone}</td>
                <td style={{width: '20%'}}>{this.props.schoolname}</td>
                <td style={{width: '12%'}}>{this.props.classname}</td>
                <td style={{width: '13%'}}>{this.props.count}</td>
                <td style={{width: '15%'}}><div className="trButton trLeft " onClick={this.props.onClickEdit}>编辑</div><div className="trButton trLeft table-delete" onClick={this.props.onClickDelete}>删除</div></td>
            </tr>
        );
    }
});
//父组件
var Main = React.createClass({
    //组件初始状态
    getInitialState: function () {
        return {
            otherData:this.props.otherData,
            tableData:this.props.tableData,
            importRepeatData:this.props.importRepeatData,
            schoolDataList:this.props.schoolDataList,
            schoolDataAll:this.props.schoolDataAll
        }
    },
    componentDidMount: function () {
        //使用ajax取出数据然后组装数据列表
        var svar = this;
        suixun.ajax(serverUrl+'/teacherManage/getTeachers.json?param={pagenumber:1,pagecount:"'+pagecount+'"}','',"get",function(data){
            setTimeout(function () {
                suixun.hideLoding();//隐藏加载中
            },200);
            if(data.code == 200 && data.info.queryresult){
                for(var i=0;i<data.info.queryresult.length;i++){
                    var obj=data.info.queryresult[i];
                    tableData[i] = {keyid:i,teachername:obj.teachername,telephone:obj.telephone,schoolname:obj.schoolname,classname:obj.classname,teacherid:obj.teacherid,count:obj.count};
                }
                var pageRight = 0;
                if(data.info.totlepage > 1){
                    pageRight = 1
                }
                otherData = {pageLeft:0,pageRight:pageRight};
                currentpage = 1;totlepage = data.info.totlepage;//初始化的时候赋值：分页的当前页和总的页数
                svar.setState({tableData:tableData,otherData:otherData});
            }
        });
        suixun.ajax(serverUrl+'/schoolManage/querySchool.json','',"get",function(data){
            if(data.code == 200 ){
                for(var i=0;i<data.info.length;i++){
                    var obj=data.info[i];
                    schoolDataList[i] = {key:i,id:obj.id,schoolname:obj.schoolname};
                }
                schoolDataAll = schoolDataList;
                svar.setState({schoolDataList:schoolDataList,schoolDataAll:schoolDataAll});
            }else{
                svar.setState({schoolDataList:schoolDataList,schoolDataAll:schoolDataAll});
            }
        });
        //绑定回车时间
        $(document).keypress(function(e) {
            var eCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
            if (eCode == 13){
                if($(".enterEvent").is(":focus")){
                    svar.onClickQuery();
                }
            }
        });
    },
    /**
     * 改变弹出层学校输入框
     * @param e
     */
    onChangSchoolInput: function (e) {
        var val = $(e.target).val();
        if(val != ""){
            this.schoolArray(val,$(e.target).attr("data-list"));
        }else{
            $("."+$(e.target).attr("data-list")+"").hide();
        }
    },
    /**
     * 排序
     * @param val
     * @param cls
     */
    schoolArray: function (val,cls) {
        schoolDataList = [];
        for(var i = 0;i < schoolDataAll.length;i++){
            if((schoolDataAll[i].schoolname).indexOf(val) >= 0){
                schoolDataList.push({schoolname:schoolDataAll[i].schoolname});
            }
        }
        if(schoolDataList.length == 0){
            $("."+cls+"").hide();
        }else{
            $("."+cls+"").show();
            this.setState({schoolDataList:schoolDataList});
        }
    },
    /**
     * 点击学校输入框
     * @param e
     */
    onClickSchool: function (e) {
        var val = $(e.target).val();
        this.schoolArray(val,$(e.target).attr("data-list"));
    },
    /**
     * 搜索查询
     */
    onClickQuery: function () {
        this.onPageClick(1);
    },
    /**
     * 分页查询
     * @param num
     */
    onPageClick: function (num) {
        //分页-调用ajac然后把数据查询出来:获取name的值
        //计算currentpage

        var onPageLeft = 0,onPageRight = 1,savr = this;
        if(num > 0){
            currentpage = num;
        }else if(num == -1 && currentpage > 1){
            currentpage --;
        }else if(num == -2  && currentpage < totlepage){
            currentpage ++;
        }else{
            return;
        }
        //修改左右的按钮
        if((currentpage == totlepage && totlepage == 1)|| totlepage == 0){
            onPageLeft = 0;
            onPageRight = 0;
        }else if(currentpage == totlepage && totlepage > 1){
            onPageLeft = 1;
            onPageRight = 0;
        }else if(1 < currentpage && currentpage < totlepage){
            onPageLeft = 1;
            onPageRight = 1;
        }
        var classPhone = $(".queryTeacherPhone").val();
        var param="param={";
        if(classPhone != "" ){
            if(!/^[1-9]\d*$/.test(classPhone)){
                suixun.alert("班主任手机号格式错误！",function (data) {
                    if(data){
                        $(".queryTeacherPhone").val("");
                    }
                });
            }else{
                param = getJsonDataNotEmpty(param,"telephone",'"'+classPhone+'"');
            }
        }
        var schoolid = "",querySchoolVal = $("#schoolname_search").val();
        if(querySchoolVal != ""){
            for(var i = 0;i < schoolDataAll.length;i++){
                if(schoolDataAll[i].schoolname == querySchoolVal){
                    schoolid = schoolDataAll[i].id;
                }
            }
        }
        if(querySchoolVal != '' && schoolid == ''){
            suixun.alert("没有该学校！",function (data) {
                if(data){
                    $("#schoolname_search").val('')
                }
            });
            return;
        }
        suixun.showLoding();//显示加载中
        param = getJsonDataNotEmpty(param,"pagenumber",'"'+currentpage+'"');
        param = getJsonDataNotEmpty(param,"schoolid",schoolid+'');
        param = getJsonDataNotEmpty(param,"pagecount",pagecount+'');
        param += "}";
        suixun.ajax(serverUrl+'/teacherManage/getTeachers.json',param,"get",function(data){
            tableData = [];
            suixun.hideLoding();//隐藏加载中
            if(data.code == 200){
                if(data.info.queryresult != null){
                    for(var i=0;i<data.info.queryresult.length;i++){
                        var obj=data.info.queryresult[i];
                        tableData[i] = {keyid:i,teachername:obj.teachername,telephone:obj.telephone,schoolname:obj.schoolname,classname:obj.classname,teacherid:obj.teacherid,count:obj.count};
                    }
                    if(data.info.totlepage > 1 && data.info.totlepage > currentpage){
                        onPageRight = 1
                    }else{
                        onPageRight = 0;
                    }
                    otherData = {pageLeft:onPageLeft,pageRight:onPageRight};
                    totlepage = data.info.totlepage;//初始化的时候赋值：分页的当前页和总的页数
                    savr.setState({tableData:tableData,otherData:otherData});
                }else{
                    totlepage = 1;//初始化的时候赋值：分页的当前页和总的页数
                    savr.setState({tableData:[],otherData:{pageLeft:0,pageRight:0}});
                }

            }
        });
    },
    /**
     * 点击批量导入
     * @returns {XML}
     */
    onClickImportExport: function () {
        $(".excelInput").show();
    },
    /**
     * 选择Excel文件
     */
    onChangFile: function () {
        var fileUrl = $("#file").val().split('\\');//注split可以用字符或字符串分割
        var fileName = fileUrl[fileUrl.length-1];//这就是要取得的图片名称
        var fileLat = fileName.substring( fileName.lastIndexOf('.')+1 );//后缀名称
        if(fileLat == "xls" || fileLat == "xlsx" ){
            $(".file_name").val(fileName);
        }else{
            suixun.alert("请选择Excel文件上传!",function (data) {
                if(data){
                    $(".file_name").val("");
                }
            });
        }
    },
    /**
     * 导入保存的按钮
     */
    excelInput: function () {
        var svar = this;
        var file_name = $(".file_name").val();
        if(file_name != ""){
            suixun.showLoding();//显示加载中
            var formData=new FormData($("#excelInputFrom")[0]);
            suixun.ajax(serverUrl+'/teacherManage/addTeachers.json',formData,"post",function(data){
                suixun.hideLoding(200);//隐藏加载中
                if(data.code == 200 && data.info == null){//成功
                    suixun.alert('导入成功',function (data) {
                        if(data){
                            $(".excelInput ").hide();
                            svar.onPageClick(currentpage);
                        }
                    })
                }else if(data.code == 200 && data.info != null){//有重复数据
                    suixun.alert('此次导入有重复数据！',function (data) {
                        if(data){
                            svar.onPageClick(currentpage);
                            $(".popImportRepeat").show();
                            $(".excelInput ").hide();
                        }
                    });
                    importRepeatData = data.info;
                    svar.setState({importRepeatData:importRepeatData});
                }else{
                    suixun.alert(data.msg);
                }
            });
        }else{
            suixun.alert("请选择上传文件!");
        }
    },
    onClickHidePop: function () {
        $("#inputExcelName").val("");
        $("#file").val("");
        $(".popModel").hide();
    },
    /**
     * 下载模版
     * @returns {XML}
     */
    excleModel: function () {
        suixun.confirm_noTit("是否下载Excel模版？",function (data) {
            if(data){
                window.location.href = serverUrl+"/teacherManage/export_TeacherTemplate.json";
            }
        });
    },
    /**
     * 删除班主任信息
     * @returns {XML}
     * @param teacherid
     */
    onClickDelete: function (teacherid) {
        var svar = this;
        var param="param={";
        param = getJsonDataNotEmpty(param,"teacherid",'"'+teacherid+'"');
        param += "}";
        suixun.confirm_noTit('是否确定删除?',function (data) {
            if(data == true){
                suixun.ajax(serverUrl+'/teacherManage/delTeacher.json',param,"get",function(data){
                    if(data.code == 200){
                        suixun.alert('删除成功！',function (data) {
                            if(data){
                                svar.onPageClick(currentpage);
                            }
                        });
                    } else {
                        suixun.alert(data.msg);
                    }
                });
            }
        });
    },
    /**
     * 编辑修改版主任老师
     * @returns {XML}
     * @param info
     */
    onClickEdit:function (info) {
        $("#teacherName").val(info[0]);
        $("#teacherPhone").val(info[1]);
        $("#teacherClassName").val(info[2]);
        $("#teacherid").val(info[3]);
        $(".popTeacher").show();
        $(".errorMsg").hide();
    },
    /**
     * 验证
     * @returns {XML}
     * @param e
     */
    onBlurInput: function (e) {
        var classname = e.target.getAttribute("data-error");
        if($(e.target).val() == ''){
            $("."+classname+"").show();
        }else{
            $("."+classname+"").hide();
        }
    },
    /**
     * 编辑教师信息-保存
     * @returns {XML}
     */
    onClickSaveEdit: function () {
        var teacherName = $("#teacherName").val(),
            teacherPhone = $("#teacherPhone").val(),
            teacherClassName = $("#teacherClassName").val();
        if(teacherName == ""){
            suixun.alert("教师名不能为空");
            return;
        }
        if(teacherPhone == ""){
            suixun.alert("手机号不能为空");
            return;
        }else if(teacherPhone.length != 11){
            suixun.alert("手机号格式错误");
            return;
        }else if(!/^1[34578]\d{9}$/.test(teacherPhone)){
            suixun.alert("手机号格式错误");
            return;
        }
        if(teacherClassName == ""){
            suixun.alert("班级不能为空");
            return;
        }
        suixun.showLoding();//显示加载中
        var svar = this;
        var param="param={";
        param = getJsonDataNotEmpty(param,"teacherid",'"'+$("#teacherid").val()+'"');
        param = getJsonDataNotEmpty(param,"teachername",'"'+teacherName+'"');
        param = getJsonDataNotEmpty(param,"telephone",'"'+teacherPhone+'"');
        param = getJsonDataNotEmpty(param,"classname",'"'+teacherClassName+'"');
        param += "}";
        suixun.ajax(serverUrl+'/teacherManage/editTeacher.json',param,"get",function(data){
            if(data.code == 200){
                suixun.alert('修改成功！',function (data) {
                    if(data){
                        $(".popTeacher").hide();
                        svar.onPageClick(currentpage);
                    }
                });
            } else {
                suixun.alert(data.msg);
            }
        });
    },
    render: function () {
        {
            var svar = this;
            var onClickArray = [this.onClickDelete,this.onClickEdit];
            var Tabels = this.state.tableData.map(function (data,index) {
                return (
                    <Table  key={index} onClickDelete={onClickArray[0].bind(svar,data.teacherid)} count={data.count} onClickEdit={onClickArray[1].bind(svar,[data.teachername,data.telephone,data.classname,data.teacherid])} listNumber={index} teachername={data.teachername} telephone={data.telephone} schoolname={data.schoolname} classname={data.classname} teacherid={data.teacherid}  />
                )
            });
            /**
             * 导入重复数据
             */
            var importRepeatDatas = importRepeatData.map(function (data,index) {
                return (
                    <tr style={{height: "36px"}}>
                        <td style={{width: '20%'}}>{parseInt(index)+1}</td>
                        <td style={{width: '40%'}}>{data.teachername}</td>
                        <td style={{width: '40%'}}>{data.telephone}</td>
                    </tr>
                )
            }.bind(this));
        }
        return (
            <div className="tableManage-body">
                <div  className="popPhone pop popModel popTeacher">
                    <div className="model"></div>
                    <div className="popModel-info popTeacher-info">
                        <div className="popModel-title">
                            <span className="popModel-title-content">
                                <span className="popModel-title-content-solid-left"/>
                                    修改教师信息
                                <span className="popModel-title-content-solid-right"/>
                            </span>
                            <span className="popModel-title-img" onClick={this.onClickHidePop}><img src="../img/icon/close.png" alt="关闭"/></span>
                        </div>
                        <div className="popModel-body">
                            <input type="hidden" id="teacherid"/>
                            <div className="popModel-body-input">
                                <span className="popModel-body-input-title">教师名</span>
                                <span className="popModel-body-input-content">
                                    <input className="input-content " data-error="teacherName-error" onBlur={this.onBlurInput}  maxLength="20" id="teacherName" type="text" placeholder="请输入教师名" />
                                </span>
                                <div className="errorMsg teacherName-error" ></div>
                            </div>
                            <div className="popModel-body-input">
                                <span className="popModel-body-input-title">手机号</span>
                                <span className="popModel-body-input-content">
                                    <input className="input-content " data-error="teacherPhone-error" onBlur={this.onBlurInput}  maxLength="11" id="teacherPhone" type="text" placeholder="请输入手机号" />
                                </span>
                                <div className="errorMsg teacherPhone-error" ></div>
                            </div>
                            <div className="popModel-body-input">
                                <span className="popModel-body-input-title">班级</span>
                                <span className="popModel-body-input-content">
                                    <input className="input-content " data-error="teacherClassName-error" onBlur={this.onBlurInput}  maxLength="30" id="teacherClassName" type="text" placeholder="请输入班级" />
                                </span>
                                <div className="errorMsg teacherClassName-error" ></div>
                            </div>
                        </div>
                        <div className="popModel-button">
                            <span className="popModel-button-ok" onClick={this.onClickSaveEdit}>确定</span>
                        </div>
                    </div>
                </div>
                <div className="pop popPhone popModel popImportRepeat ">
                    <div className="model"></div>
                    <div className="pop-info popModel-info popPhone-info">
                        <div className="pop-title popPhone-title">
                                <span className="pop-title-content popPhone-title-content" style={{fontSize:"18px"}}>
                                    <span className="pop-title-content-solid-left popPhone-title-content-solid-left"/>
                                        导入班主任信息重复数据
                                    <span className="pop-title-content-solid-right popPhone-title-content-solid-right"/>
                                </span>
                            <span className="pop-title-img popPhone-title-img" onClick={this.onClickHidePop}><img src="../img/icon/close.png" alt="关闭"/></span>
                            <input type="hidden" name="batch_id" id="batch_id"/>
                        </div>
                        <div className="pop-body ">
                            <div className="tableInfo importRepeatTableInfo">
                                <div className="studentsInfo-data tableInfo-data">
                                    <div className="studentsInfo-data-table tableInfo-data-table" >
                                        <table className="head-body ">
                                            <thead>
                                                <th style={{width: '20%',height: "20px"}}>序号</th>
                                                <th style={{width: '40%',height: "30px"}}>教师名</th>
                                                <th style={{width: '40%',height: "30px"}}>手机号</th>
                                            </thead>
                                            <tbody >
                                                {importRepeatData==""?'':importRepeatDatas}
                                            </tbody>
                                        </table>
                                            {importRepeatData==""?<div className="tableNoData">{tableNoDataCount}</div>:''}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div className="messagePrompt" >注：以上为此次导入重复数据，其他数据已导入成功!</div>
                    </div>
                </div>
                <div  className="pop popPhone excelInput popModel">
                    <div className="model"></div>
                    <div className="pop-info popModel-info excelInput-info">
                        <div className="pop-title popModel-title ">
                                <span className="pop-title-content popModel-title-content">
                                    <span className="pop-title-content-solid-left popModel-title-content-solid-left" />
                                        导入班主任信息
                                    <span className="pop-title-content-solid-right popModel-title-content-solid-right" />
                                </span>
                            <span className="pop-title-img popModel-title-img" onClick={this.onClickHidePop}><img src="../img/icon/close.png" alt="关闭"/></span>
                        </div>
                        <div className="pop-body popModel-body">
                            <div className="popModel-body-input">
                                <span className="popModel-body-input-title" style={{width: "108px",lineHeight:"41px",backgroundPosition:"106px 0px"}}>选择Excel文件</span>
                                <form name="excelInputForm" id="excelInputFrom"  enctype="multipart/form-data" method="post">
                                    <input className="file_name input-content export-imei" style={{left: "-3px"}} type="text" id="inputExcelName" name="filename" readOnly="readOnly"/>
                                    <a href="javascript:;" className="file">选择文件
                                        <input type="file" onChange={this.onChangFile}  name="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.ms-excel,application/vnd.ms-excel,application/vnd.ms-excel,application/vnd.ms-excel " id="file" />
                                    </a>
                                </form>
                            </div>
                        </div>
                        <div className="popModel-button" style={{bottom: "12px"}}>
                            <span className="popModel-button-ok" onClick={this.excelInput}>导入</span>
                        </div>
                    </div>
                </div>
                <header>
                    <div className="header-left">
                        <div className="header-left-studentInfo">
                            <a href="../parentInfoManage/queryParentList.html" className="header-left-button ">家长管理</a>
                            <a href="../teacherManage/classTeacher.html" className="header-left-button showOrder" style={{left:"10px"}}>教师管理</a>
                            <a href="../studentInfoManage/queryStduentList.html" className="header-left-button" style={{left:"20px"}}>学生管理</a>
                        </div>
                        <div className="header-left-annotationsInfo">
                            <img src="../img/icon/annotations.png" />
                            <span className="header-left-annotations-arrowsLeft"/>
                            <div className="header-left-annotations">这里是注释。</div>
                        </div>
                    </div>
                    <div className="header-right">
                        <div className="header-right-query" style={{left: "-20px"}} >
                            <div className="header-right-query-input">
                                <input className="queryVal enterEvent" type="text" onChange={this.onChangSchoolInput} onClick={this.onClickSchool}  data-list="schoolname_search"  name="schoolname_search" id="schoolname_search" maxLength="50" placeholder="请输入学校关键词"/>
                            </div>
                            <div className="header-right-query-img" onClick={this.onClickQuery}></div>
                            <div className="schoolList schoolname_search " data-inputId="schoolname_search">
                                {
                                    schoolDataList.map(function (data) {
                                        return (
                                            <span className="schoolList-value" >{data.schoolname}</span>
                                        )
                                    })
                                }
                            </div>
                        </div>
                        <div className="header-right-query" style={{left: "-10px"}} >
                            <div className="header-right-query-input">
                                <input className="queryVal enterEvent queryTeacherPhone" type="text" maxLength="11" placeholder="搜索班主任手机号"/>
                            </div>
                            <div className="header-right-query-img" onClick={this.onClickQuery}></div>
                        </div>
                        <div className="header-left-studentInfo" onClick={this.onClickImportExport}>
                            <span className="header-left-button showOrder importClassInfo" style={{left: "3px"}}  >导入班主任信息</span>
                        </div>
                        <div className="header-left-studentInfo" onClick={this.excleModel}>
                            <span className="header-left-button showOrder importClassInfo" >EXCEL模版下载</span>
                        </div>
                    </div>
                </header>
                <div className="parentsInfo tableInfo">
                    <div className="parentsInfo-data tableInfo-data">
                        <div className="parentsInfo-data-table tableInfo-data-table" >
                            <table className="head-body head-body">
                                <thead>
                                    <th style={{width: '10%'}}>序号</th>
                                    <th style={{width: '15%'}}>教师名</th>
                                    <th style={{width: '15%'}}>手机号</th>
                                    <th style={{width: '20%'}}>学校</th>
                                    <th style={{width: '13%'}}>班级</th>
                                    <th style={{width: '12%'}}>考勤卡发放量</th>
                                    <th style={{width: '15%'}}>操作</th>
                                </thead>
                                <tbody>
                                {this.state.tableData==""?'':Tabels}
                                </tbody>
                            </table>
                            {this.state.tableData==""?<div className="tableNoData">{tableNoDataCount}</div>:''}
                        </div>
                    </div>
                    <Page otherData={this.state.otherData} onPageClick={this.onPageClick} />
                </div>
                <footer id="copyright">
                    <span><img src="../img/icon/copyright.png"/>{copyright}</span>
                </footer>
            </div>
        );
    }
});
ReactDOM.render(
    <Main  otherData={otherData} tableData={tableData} importRepeatData={importRepeatData} schoolDataList={schoolDataList} schoolDataAll={schoolDataAll} />,
    document.getElementById('tableManage')
);
//学校下拉列表
$("*").bind("click",function(e){
    var target = $(e.target);
    if(target.closest(".schoolList-value").length == 1){
        $("#schoolname_search").val(target.html());
    }
    $(".schoolList").hide();
});
